# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-06-15
# @File : 2_hook_device_token_str.py


import frida
import sys

rdev = frida.get_remote_device()
# Application(identifier="tv.danmaku.bili", name="哔哩哔哩", pid=20650, parameters={})
session = rdev.attach("唯品会")

scr = """
Java.perform(function () {

    var c = Java.use("hk.c");
    c.u0.implementation = function(str){
        console.log("——————————————————————请求来了——————————————————————");
        console.log("str",str);
        console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
        var res = this.u0(str)
        return res;
    };
    

});
"""

script = session.create_script(scr)


def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
sys.stdin.read()
